package org.mm.model;

import java.io.Serializable;
import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Version;


/**
 * The persistent class for the measurements database table.
 *
 */
@Entity
@Table(name="measurements")
public class Measurement implements Serializable {

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 2257216947435061898L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="measurement_id")
	private Long measurementId;


	@Column(name="measurement_creation_date")
	private Timestamp measurementCreationDate;

	@Column(name="measurement_description")
	private String measurementDescription;

	@Column(name="measurement_data")
	private String measurementData;

	@Column(name="measurement_last_modification_date")
	private Timestamp measurementLastModificationDate;

	@Version
	@Column(name="measurement_version")
	private int measurementVersion;

	//bi-directional many-to-one association to Patient
	@ManyToOne
	@JoinColumn(name="measurement_patient_id")
	private Patient patient;

	//bi-directional many-to-one association to Sensor
	@ManyToOne
	@JoinColumn(name="measurement_sensor_id")
	private Sensor sensor;

	//bi-directional many-to-one association to User
	@ManyToOne
	@JoinColumn(name="measurement_created_by_user")
	private User user1;

	//bi-directional many-to-one association to User
	@ManyToOne
	@JoinColumn(name="measurement_last_modified_by_user")
	private User user2;

/*	//bi-directional many-to-one association to TherapyTaskEvent
	@OneToMany(mappedBy="measurement", fetch=FetchType.EAGER)
	private List<TherapyTaskEvent> therapyTaskEvents;*/

	public Measurement() {
	}

	public Long getMeasurementId() {
		return this.measurementId;
	}

	public void setMeasurementId(Long measurementId) {
		this.measurementId = measurementId;
	}

	public Timestamp getMeasurementCreationDate() {
		return this.measurementCreationDate;
	}

	public void setMeasurementCreationDate(Timestamp measurementCreationDate) {
		this.measurementCreationDate = measurementCreationDate;
	}

	public String getMeasurementData() {
		return this.measurementData;
	}

	public void setMeasurementData(String measurementData) {
		this.measurementData = measurementData;
	}

	/**
	 * getMeasurementDescription
	 * @return measurementDescription
	 */
	public String getMeasurementDescription() {
		return measurementDescription;
	}

	/**
	 * setMeasurementDescription
	 * @param measurementDescription
	 */
	public void setMeasurementDescription(String measurementDescription) {
		this.measurementDescription = measurementDescription;
	}

	public Timestamp getMeasurementLastModificationDate() {
		return this.measurementLastModificationDate;
	}

	public void setMeasurementLastModificationDate(Timestamp measurementLastModificationDate) {
		this.measurementLastModificationDate = measurementLastModificationDate;
	}

	public int getMeasurementVersion() {
		return this.measurementVersion;
	}

	public void setMeasurementVersion(int measurementVersion) {
		this.measurementVersion = measurementVersion;
	}

	public Patient getPatient() {
		return this.patient;
	}

	public void setPatient(Patient patient) {
		this.patient = patient;
	}

	public Sensor getSensor() {
		return this.sensor;
	}

	public void setSensor(Sensor sensor) {
		this.sensor = sensor;
	}

	public User getUser1() {
		return this.user1;
	}

	public void setUser1(User user1) {
		this.user1 = user1;
	}

	public User getUser2() {
		return this.user2;
	}

	public void setUser2(User user2) {
		this.user2 = user2;
	}

/*	public List<TherapyTaskEvent> getTherapyTaskEvents() {
		return this.therapyTaskEvents;
	}

	public void setTherapyTaskEvents(List<TherapyTaskEvent> therapyTaskEvents) {
		this.therapyTaskEvents = therapyTaskEvents;
	}

	public TherapyTaskEvent addTherapyTaskEvent(TherapyTaskEvent therapyTaskEvent) {
		getTherapyTaskEvents().add(therapyTaskEvent);
		therapyTaskEvent.setMeasurement(this);

		return therapyTaskEvent;
	}

	public TherapyTaskEvent removeTherapyTaskEvent(TherapyTaskEvent therapyTaskEvent) {
		getTherapyTaskEvents().remove(therapyTaskEvent);
		therapyTaskEvent.setMeasurement(null);

		return therapyTaskEvent;
	}
*/
}